$(function(){
    //common
    ;(function(){
        var url=location.search;
        var Request = new Object();
        if(url.indexOf("?")!=-1){
            var str = url.substr(1);
            strs = str.split("&");
            for(var i=0;i<strs.length;i++){
                Request[strs[i ].split("=")[0]]=unescape(strs[i].split("=")[1]);
            }
        }
        var id = Request["id"];

        $.ajax({// ../articledetail/list.do
            url:'../articledetail/byIdContent.do?id='+id,
            async:false,
            data:{id:id},
            dataType:"json",
            success:function(json){
                //json = JSON.parse(json);
                var XHtml=template('xScr', json);
                $('#xCont').html(XHtml);

                var id=json.data[0].id;
                var cid=json.data[0].cid;
                tab(id, cid, 'x7Scr', '#x7List');
            }
        })
    })();

    function tab(id, cid, addressT, addressH){
        $.ajax({// ../article/relationlist.do?id=4&cid=101 ;  data/x7List.json data/x7List.json
            url:'../article/relationlist.do',
            async:false,
            type:'POST',
            data:{cid:cid, id:id},
            success:function(json){
                //alert(JSON.parse(json));
                json = JSON.parse(json);
                var XHtml=template(addressT, json.data);
                $(addressH).html(XHtml);
            }
        })
    }
});
